package com.facotry.config;

import com.facotry.util.AuthorizationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * --- 代码敲烂 月薪过万 ---
 *
 * @author 崔瑜航
 * @date 2024/7/30
 * @desc  配置拦截器
 */
@Configuration
public class MyWebMvcInterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private AuthorizationInterceptor authorizationInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(authorizationInterceptor)//把拦截器放进来
            .addPathPatterns("/**")//拦截所有
            .excludePathPatterns("/user/login");//登录放行

    }
}
